package com.qidian.mes.quality.service.impl;

import com.qidian.common.pojo.MESResult;
import com.qidian.mes.pojo.Detect;
import com.qidian.mes.pojo.Model;
import com.qidian.mes.quality.mapper.ModelMapper;
import com.qidian.mes.quality.service.ModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author gfdycxy
 * @Company cxy
 * @Description
 * @Time 2024/10/18 13:45
 */
@Service
public class ModelServiceImpl implements ModelService {
    @Autowired
    private ModelMapper modelMapper;
    @Override
    public MESResult selectAll() {
        return MESResult.success(modelMapper.selectAll());
    }

    @Override
    public MESResult deleteById(Long modelId) {
        return modelMapper.deleteById(modelId)==1?MESResult.success():MESResult.error();
    }

    @Override
    public MESResult queryById(Long modelId) {
        return  MESResult.success(modelMapper.queryById(modelId));
    }

    @Override
    public MESResult insert(Model model) {
        return modelMapper.insert(model)==1?MESResult.success():MESResult.error();
    }

    @Override
    public MESResult updateById(Model model) {
        return modelMapper.updateById(model)==1?MESResult.success():MESResult.error();
    }

    @Override
    public MESResult selectAllDetect() {
        return MESResult.success(modelMapper.selectAllDetect());
    }

    @Override
    public MESResult updateDetectionById(Detect detect) {
        return modelMapper.updateDetectionById(detect)==1?MESResult.success():MESResult.error();
    }

    @Override
    public MESResult deleteModelDetectionById(Long detectId) {
        return modelMapper.deleteModelDetectionById(detectId)==1?MESResult.success():MESResult.error();
    }

    @Override
    public MESResult getModelDetectById(Long detectId) {
        return MESResult.success(modelMapper.getModelDetectById(detectId));
    }

    @Override
    public MESResult insertNewModelDetection(Detect detect) {
        return modelMapper.insertNewModelDetection(detect)==1?MESResult.success():MESResult.error();
    }
}